
import { _decorator, Component, Node, Script, director } from 'cc';
// import audioController from '../audio/audioController'
import useStore from "../store";
import { Constants } from "../data/Constants";
import { UIManager } from "../utils/UIManager";
import { AudioManager } from "../audio/AudioManager";
const { ccclass, property } = _decorator;

@ccclass('homeBtnMgr')
export class homeBtnMgr extends Component {

    // @property(Script)
    // audioController: Script = null



    goStartGame() {
        if (!useStore().userStore.userInfo.nickname) return
        console.log('开始游戏')
        director.loadScene('game')
    }


    handleBase(even, customEventData: string) {
        if (!useStore().userStore.userInfo.nickname) return
        console.log(even, customEventData)
        AudioManager.playSound(Constants.AudioSource.BTNCLICK);
        switch (customEventData) {
            case '1':
                director.loadScene('ranking')
                break;
            case '2':
                director.loadScene('achievement')
                break;
            case '3':
                UIManager.showDialog(Constants.UIPage.setDialog);
                break;

            default:
                break;
        }
    }


    update(deltaTime: number) {

    }
}

